<?php
namespace app\common\validate;

use think\Validate;

class Arctype extends Validate
{
    protected $rule = [
        'pid' => 'require|integer|different:id',
        'typename' => 'require',
        'mod' => 'require|alpha',
        'dirs' => 'require|alphaDash',
        'target' => 'require',
        'templist' => 'require|alphaDash',
        'temparticle' => 'require|alphaDash',
        'pagesize' => 'require|integer|>=:1',
        'sorts' => 'require|integer|>=:1',
        'status' => 'require|in:0,1',
    ];

    protected $message = [
        'pid' => 'pid_require',
        'pid.different' => 'pid_different',
        'typename' => 'typename_require',
        'mod' => 'mod_require',
        'dirs' => 'dirs_require',
        'target' => 'target_require',
        'templist' => 'templist_require',
        'temparticle' => 'temparticle_require',
        'pagesize' => 'pagesize_require',
        'sorts' => 'sorts_require',
        'status' => 'status_require',
    ];

    protected $scene = [
        'create' => ['pid', 'typename', 'mod', 'dirs', 'target', 'templist', 'temparticle', 'pagesize', 'sorts', 'status'],
        'edit'   => ['pid', 'typename', 'mod', 'dirs', 'target', 'templist', 'temparticle', 'pagesize', 'sorts', 'status'],
        'typename' => ['typename'],
        'dirs'   => ['dirs'],
        'sorts'  => ['sorts'],
        'status' => ['status'],
    ];
}